-
Notifications
You must be signed in to change notification settings - Fork 228
feat(compass-indexes): Add view support to indexes tab COMPASS-9667 #7182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds view support to the indexes tab for MongoDB versions 8.0+ and 8.1+, enabling search index management on views with version-specific functionality. The implementation includes new banners, empty states, and conditional rendering based on MongoDB version and environment (Compass vs Data Explorer).
- Introduces version-specific banners and empty states for views with different MongoDB versions
- Adds conditional fetching and rendering of search indexes for readonly views
- Updates the indexes toolbar to support view-specific functionality and disable standard indexes tab for views
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
atlas-upgrade-cluster-link.ts |
New utility function to generate Atlas cluster upgrade links |
store.ts |
Updated search index fetching logic to support views on MongoDB 8.0+ |
search-indexes.ts |
Modified fetchIndexes to allow search index fetching for views on MongoDB 8.1+ |
view-version-incompatible-banners.tsx |
New component providing version-specific upgrade banners for views |
indexes.tsx |
Updated main component to handle view support with conditional rendering and banners |
indexes.spec.tsx |
Added test coverage for view support scenarios |
indexes-toolbar.tsx |
Enhanced toolbar with view-specific controls and automatic tab selection |
indexes-toolbar.spec.tsx |
Added tests for toolbar behavior with readonly views |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/compass-indexes/src/components/indexes-toolbar/indexes-toolbar.tsx
Outdated
Show resolved
Hide resolved
...dexes/src/components/view-version-incompatible-banners/view-version-incompatible-banners.tsx
Show resolved
Hide resolved
const mongoDBMajorVersion = parseFloat( | ||
serverVersion.split('.').slice(0, 2).join('.') | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use semver package for handling mongodb version comparison, you can't really rely fully on the version here being fully parseable as a number (because it's not). There are some examples in the code here that already use semver for similar checks (see serverSupportsSearchIndexManagement
for example), please update your code to the similar pattern
useEffect(() => { | ||
// If the view is readonly, set the default tab to 'search-indexes' | ||
if (isReadonlyView && indexView !== 'search-indexes') { | ||
onIndexViewChanged('search-indexes'); // Update redux state | ||
} | ||
}, [indexView, isReadonlyView, onIndexViewChanged]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redux store owns this state and redux store reducer controls how exactly this state is set, this shouldn't be an effect in the view, please move this logic to the store
Description
Change indexes tab to support views. Figma
COMPASS-9667
compass_view_support_indexes.mov
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes